Skip to content

fix(core): tighten component matching, diff line budget and relationship deduplication - #409

Merged
parse merged 10 commits into
mainfrom
fix/small-correctness-fixes
Nov 18, 2026
Merged

parse merged 10 commits into
mainfrom
fix/small-correctness-fixes

Conversation

@parse

@parse parse commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #408.

What changed

  • Component selection: ids match as whole tokens and the earliest mention wins, so api-gateway no longer selects api and "api. api-worker is not affected" selects api.
  • Line budget: maxLinesPerDiff now drops files instead of only warning. It runs once in the shared pipeline after skip patterns, for both analyze and check, skips oversized files and keeps smaller ones after them. The first file is always kept, its patch cut to the budget.
  • Output budget: the dependency scan uses the medium output size. Anthropic small stays 600.
  • excludePaths: matches whole id segments (cloud.api no longer excludes cloud.apigateway). Whitespace and a trailing . are tolerated.
  • Relationship duplicates (LikeC4): a proposal is a duplicate of a same-endpoint relationship unless both have a kind and the kinds differ, in both directions. Structurizr still matches on endpoints only.
  • Structurizr strings: " becomes ' instead of being stripped; newlines collapse to spaces.
  • Templates: a missing variable renders empty with a verbose-mode warning. findMissingVariables lets tests catch renamed variables in every real template.

Behaviour changes

  • Large diffs are trimmed to the line budget; the truncation reason lists dropped files.
  • excludePaths written as string prefixes no longer match unrelated ids.

Review follow-ups

  • A proposed kind the model does not define counts as no kind, matching what the LikeC4 writer emits.
  • Line-budget truncation reaches results: truncation.reason, structured output wasTruncated/truncationReason (declared before but never set), and a partial-analysis note in the PR comment.
  • Changed-line counting tracks hunks, so content lines such as ---- count.

Checks

Check Result
check:ci pass
knip pass
Tests 1055 core + 10 cli pass

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: one or more packages not found in the registry.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge as part of the stack, including PR #412.

Summary

Tightens component selection and relationship checks, enforces diff limits, and makes partial results visible.

  • The check command bases its CI result on whether analysis found violations.
  • Analysis trims oversized diffs and reports when its results are partial.
  • AI component selection matches the earliest whole component ID in its reply.
  • Dependency scans get more output room than component picks.
  • LikeC4 exclusions match complete path segments, not shared prefixes.
  • Relationship deduplication distinguishes LikeC4 kinds but keeps Structurizr endpoint matching.
  • Structurizr model text keeps quoted words and collapses newlines.
  • Missing template values render empty and warn in verbose mode.
  • Prompts keep untrusted pull-request content and credentials out of model instructions.

No new unresolved findings. The earlier relationship-kind, truncation-reporting, and changed-line-counting issues are addressed. Preserving unusual local file paths after trimming depends on the parser fixes in dependent PR #412; those fixes are not in this PR.

Reviews (3) · Last reviewed commit: "fix(core): address review findings on li..." · Reviewed by Greptile

Comment thread packages/core/src/pipelines/analyze.ts Resolved
@parse
parse force-pushed the fix/small-correctness-fixes branch from 9ea783c to 491682b Compare November 17, 2026 18:09
Base automatically changed from fix/ci-gate-and-secret-hygiene to main November 18, 2026 07:16
parse added 10 commits November 18, 2026 08:16
- apply the line budget in the shared pipeline after skip patterns, for analyze and check; skip oversized files instead of stopping
- dedupe relationships by kind only for LikeC4 (Structurizr keeps endpoint matching)
- normalise excludePaths (whitespace, trailing dot) and document segment semantics
- matchComponentId prefers the earliest match in the reply
- dependency scan uses the medium output budget; Anthropic small back to 600
- template engine renders missing variables empty with a debug warning
- Dedup resolves a proposal's kind the same way the LikeC4 writer does, via a shared helper; an undefined kind counts as no kind
- Report files dropped by the line budget on the analysis result, structured output (changeRequest.wasTruncated/truncationReason) and PR comment, for analyze and check
- Count +/- lines as content after a hunk header, so removed ---- and added +++x lines count toward the budget
@parse
parse force-pushed the fix/small-correctness-fixes branch from 491682b to 5780a2c Compare November 18, 2026 07:16
@parse
parse merged commit 79e083a into main Nov 18, 2026
9 of 10 checks passed
@parse
parse deleted the fix/small-correctness-fixes branch November 18, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant